{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { isOptionGroup } from './useSelect.types';\nexport function areOptionsEqual(option1, option2) {\n  return option1.label === option2.label && option1.value === option2.value && option1.disabled === option2.disabled;\n}\nexport function getOptionsFromChildren(children) {\n  if (children == null) {\n    return [];\n  }\n  var selectChildren = [];\n  React.Children.forEach(children, function (node) {\n    var _props, _props2, _element$props$disabl2;\n    var nodeChildren = node == null ? void 0 : (_props = node.props) == null ? void 0 : _props.children;\n    if ((node == null ? void 0 : (_props2 = node.props) == null ? void 0 : _props2.value) === undefined) {\n      if (nodeChildren != null) {\n        var _element$props$disabl;\n        var _element = node;\n        var group = {\n          options: getOptionsFromChildren(nodeChildren),\n          label: _element.props.label,\n          disabled: (_element$props$disabl = _element.props.disabled) != null ? _element$props$disabl : false\n        };\n        selectChildren.push(group);\n      }\n      return;\n    }\n    var element = node;\n    var option = {\n      value: element.props.value,\n      label: element.props.label || element.props.children,\n      disabled: (_element$props$disabl2 = element.props.disabled) != null ? _element$props$disabl2 : false\n    };\n    selectChildren.push(option);\n  });\n  return selectChildren != null ? selectChildren : [];\n}\nexport function flattenOptionGroups(groupedOptions) {\n  var isGroupDisabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n  var flatOptions = [];\n  groupedOptions.forEach(function (optionOrGroup) {\n    if (isOptionGroup(optionOrGroup)) {\n      flatOptions = flatOptions.concat(flattenOptionGroups(optionOrGroup.options, optionOrGroup.disabled));\n    } else {\n      flatOptions.push(_extends({}, optionOrGroup, {\n        disabled: isGroupDisabled || optionOrGroup.disabled\n      }));\n    }\n  });\n  return flatOptions;\n}","map":{"version":3,"names":["_extends","React","isOptionGroup","areOptionsEqual","option1","option2","label","value","disabled","getOptionsFromChildren","children","selectChildren","Children","forEach","node","_props","_props2","_element$props$disabl2","nodeChildren","props","undefined","_element$props$disabl","element","group","options","push","option","flattenOptionGroups","groupedOptions","isGroupDisabled","flatOptions","optionOrGroup","concat"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@mui/base/SelectUnstyled/utils.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { isOptionGroup } from './useSelect.types';\nexport function areOptionsEqual(option1, option2) {\n  return option1.label === option2.label && option1.value === option2.value && option1.disabled === option2.disabled;\n}\nexport function getOptionsFromChildren(children) {\n  if (children == null) {\n    return [];\n  }\n  const selectChildren = [];\n  React.Children.forEach(children, node => {\n    var _props, _props2, _element$props$disabl2;\n    const nodeChildren = node == null ? void 0 : (_props = node.props) == null ? void 0 : _props.children;\n    if ((node == null ? void 0 : (_props2 = node.props) == null ? void 0 : _props2.value) === undefined) {\n      if (nodeChildren != null) {\n        var _element$props$disabl;\n        const element = node;\n        const group = {\n          options: getOptionsFromChildren(nodeChildren),\n          label: element.props.label,\n          disabled: (_element$props$disabl = element.props.disabled) != null ? _element$props$disabl : false\n        };\n        selectChildren.push(group);\n      }\n      return;\n    }\n    const element = node;\n    const option = {\n      value: element.props.value,\n      label: element.props.label || element.props.children,\n      disabled: (_element$props$disabl2 = element.props.disabled) != null ? _element$props$disabl2 : false\n    };\n    selectChildren.push(option);\n  });\n  return selectChildren != null ? selectChildren : [];\n}\nexport function flattenOptionGroups(groupedOptions, isGroupDisabled = false) {\n  let flatOptions = [];\n  groupedOptions.forEach(optionOrGroup => {\n    if (isOptionGroup(optionOrGroup)) {\n      flatOptions = flatOptions.concat(flattenOptionGroups(optionOrGroup.options, optionOrGroup.disabled));\n    } else {\n      flatOptions.push(_extends({}, optionOrGroup, {\n        disabled: isGroupDisabled || optionOrGroup.disabled\n      }));\n    }\n  });\n  return flatOptions;\n}"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,aAAa,QAAQ,mBAAmB;AACjD,OAAO,SAASC,eAAe,CAACC,OAAO,EAAEC,OAAO,EAAE;EAChD,OA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